/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Andres
 */
@Entity
@Table(name = "SOLICITUD", catalog = "", schema = "PROYECTO")
@NamedQueries({
    @NamedQuery(name = "Solicitud.findAll", query = "SELECT s FROM Solicitud s"),
    @NamedQuery(name = "Solicitud.findByIdsolicitud", query = "SELECT s FROM Solicitud s WHERE s.idsolicitud = :idsolicitud"),
    @NamedQuery(name = "Solicitud.findByConcepto", query = "SELECT s FROM Solicitud s WHERE s.concepto = :concepto")})
public class Solicitud implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "IDSOLICITUD", nullable = false)
    private Integer idsolicitud;
    @Basic(optional = false)
    @Column(name = "CONCEPTO", nullable = false, length = 350)
    private String concepto;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "solicitud", fetch = FetchType.EAGER)
    private List<Solicitudinsumo> solicitudinsumoList;
    @JoinColumn(name = "CARTA_CODRADICACION", referencedColumnName = "CODRADICACION", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Carta carta;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "solicitud", fetch = FetchType.EAGER)
    private List<Solicitudrecurso> solicitudrecursoList;

    public Solicitud() {
    }

    public Solicitud(Integer idsolicitud) {
        this.idsolicitud = idsolicitud;
    }

    public Solicitud(Integer idsolicitud, String concepto) {
        this.idsolicitud = idsolicitud;
        this.concepto = concepto;
    }

    public Integer getIdsolicitud() {
        return idsolicitud;
    }

    public void setIdsolicitud(Integer idsolicitud) {
        this.idsolicitud = idsolicitud;
    }

    public String getConcepto() {
        return concepto;
    }

    public void setConcepto(String concepto) {
        this.concepto = concepto;
    }

    public List<Solicitudinsumo> getSolicitudinsumoList() {
        return solicitudinsumoList;
    }

    public void setSolicitudinsumoList(List<Solicitudinsumo> solicitudinsumoList) {
        this.solicitudinsumoList = solicitudinsumoList;
    }

    public Carta getCarta() {
        return carta;
    }

    public void setCarta(Carta carta) {
        this.carta = carta;
    }

    public List<Solicitudrecurso> getSolicitudrecursoList() {
        return solicitudrecursoList;
    }

    public void setSolicitudrecursoList(List<Solicitudrecurso> solicitudrecursoList) {
        this.solicitudrecursoList = solicitudrecursoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idsolicitud != null ? idsolicitud.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Solicitud)) {
            return false;
        }
        Solicitud other = (Solicitud) object;
        if ((this.idsolicitud == null && other.idsolicitud != null) || (this.idsolicitud != null && !this.idsolicitud.equals(other.idsolicitud))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Solicitud[idsolicitud=" + idsolicitud + "]";
    }

}
